package com.css.dzj.zfjg.modules.creditassess.mapper;

import com.css.dzj.zfjg.modules.creditassess.entity.JgLhjgCreditAssessEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 企业信用评估信息Mapper
 */
@Repository
public interface CreditassessMapper extends JpaRepository<JgLhjgCreditAssessEntity, String>, JpaSpecificationExecutor<JgLhjgCreditAssessEntity>,
        QuerydslPredicateExecutor<JgLhjgCreditAssessEntity> {


    /**
     * 查询企业信用评估信息(按照企业分数降序下载)
     * nativeQuery = true:标志着为sql语句
     * @return
     */
    @Query(value = "select n.Enterprise_Name 企业名称,n.Enterprise_Id_Type 企业证件类型,n.Enterprise_Id_Number 企业证件号码, \n" +
            "n.Enterprise_Mark 企业分数,n.Evaluation_Date 评估日期, n.Enterprise_Type 企业分类 \n"+
            "from DZJZFJG.JG_LHJG_CREDIT_ASSESS n \n" +
            "order by n.Enterprise_Mark DESC",nativeQuery = true)
    public List<Map> getAll();
}